Executing tests with batch files

You can use TPT on the command line to automate your test execution or create a .tptbatch file using the Batch Runner view.

To open the Batch Runner view in TPT, go to View|Show View|Batch Runner.

The Batch Runner view is used to create a batch file for executing several execution configurations in multiple TPT files or TPT API scripts sequentially in the background. Select View|Show View|Batch Runner to open the Batch Runner view.

Batch Runner view

The toolbar contains the following elements:

create a new batch configuration (Ctrl+N)
open a batch configuration (Ctrl+O)
save batch configuration (Ctrl+S), save batch configuration as (Ctrl+Alt+S)
submenu of ; export the batch configuration as Windows batch file; select this icon to generate a batch file using the currently displayed batch configuration (.bat)
add a new step, by default, Execute tests step is inserted (Insert)
remove the selected step (Del)
duplicate the selected step (Ctrl+B)
move the selected step up/ down (Ctrl+Up/Down)
start the batch execution of all steps;
start batch execution only of the enabled or disabled selected step
terminate the batch execution
show/hide the log panel
clear information about the batch process displayed in the Log panel

The view offers 4 batch step types. You can select them from the drop-down list below the table. Each step has different settings. The file can either be exported as Windows batch file or saved as tptbatch file.

The paths to referenced TPT files are by default saved as absolute paths in tptbatch files. They are only saved as relative paths if the TPT files are located on the same partition.

Step type selection in the 'Batch Runner view'

[Enabled/disabled]

Batch steps can be disabled or enabled. To disable a steps, select them in the table and click Enabled; the icon changes to . To enable them, click the icon again.

Click Execute selected to execute a batch step even if it is disabled.

Steps

This column lists the details of each batch step. The details are specified in the section below the table.

Status

This column shows the execution status during the batch execution for each batch step.

Execute Tests step

This step is necessary to execute test cases of a TPT project. You must select a TPT model and an execution configuration, see also Create execution configuration items.

'Execute Tests' step

TPT model

When you have saved the batch file as .tptbatch, a relative file path is possible. The path to the file can be changed. The file itself can be replaced by another one without the need to replace the Execute Tests step.

To add a TPT file, click in the TPT model text field and then the three dots button "...".

You can also drag a project from the Project view to insert the TPT model and the default Execution config automatically.

Execution config

A TPT model file can contain several execution configurations. Select one from the drop-down list. The list is automatically updated when you add new execution configurations to your TPT model or when you remove execution configurations.

Additional arguments

Additional arguments can be added (optional). For an overview of the command line parameters that are important for the Execute Tests step, see Build plug-in.

Open Report

Test report for the batch step. Is only available after the step has been executed.

Double-click or right-click at the step in the table and select Open to open the project in TPT.

Execute API Script step

This step executes a TPTAPI script. The script can be created in the API Script Editor view, see API Script Editor view.

'Execute API Script' step

Execute script

Select a .tptapi or .py file that should be executed by TPT.

Additional arguments

The arguments are passed to the script and are accessible in the Python script via

import sys

script_file = sys.argv[0]

arg_1 = sys.argv[1]

See also Python bindings.

Double-click or right-click at the step in the table and select Open to open the file in the API Script Editor, see API Script Editor view.

Generate Testframe step

This step is only supported when using the ASCET platform, ASCET@FUSION platform, AUTOSAR platform, C/C++ platform, or MATLAB/Simulink platform.

'Generate Testframe' step

TPT model

The path to the file can be changed and a file can be replaced by another one. Click on a file and use the three dots button "..." in the column. The execution configuration of the new file is loaded automatically.

You can also drag a project from the Project view to the TPT model field.

Platform

Select the platform for which the test frame should to be generated.

Double-click or right-click at the step in the table and select Open to open the project in TPT.

Batch Overview Report step

This step generates a report for all executed execution configurations placed before it. The report section for Execute Tests steps placed after the Batch Overview Report step will be empty.

'Batch Overview Report' step

Target folder

Specify the output folder. Leave this filed empty to use the directory of your TPTBATCH file.

Open Batch Overview Report

Is only available after the step has been executed.

Double-click or right-click at the step in the table and select Open to open the report location in the explorer.